function [data_random] = dry_bean_read(file_arff)
    % 读取Dry Bean Dataset ARFF文件
    fid = fopen(file_arff, 'rt');
    
    % 初始化变量
    attributes = {};
    data_started = false;
    raw_data = {};
    line_count = 0;
    
    % 逐行读取文件
    while ~feof(fid)
        line = strtrim(fgetl(fid));
        
        % 跳过空行和注释行
        if isempty(line) || startsWith(line, '%') || startsWith(line, '@RELATION')
            continue;
        end
        
        % 解析属性定义
        if startsWith(line, '@ATTRIBUTE')
            parts = strsplit(line);
            attr_name = parts{2};
            attributes{end+1} = attr_name;
            continue;
        end
        
        % 检测数据部分开始
        if startsWith(line, '@DATA')
            data_started = true;
            continue;
        end
        
        % 读取数据部分
        if data_started
            line_count = line_count + 1;
            raw_data{line_count} = line;
        end
    end
    fclose(fid);
    
    % 确定特征数量（总属性数减1，因为最后一列是类别）
    num_features = length(attributes) - 1;
    
    % 初始化数据矩阵
    num_data = zeros(line_count, num_features);
    classes = cell(line_count, 1);
    
    % 解析数据行
    for i = 1:line_count
        parts = strsplit(raw_data{i}, ',');
        
        % 提取特征值
        for j = 1:num_features
            num_data(i, j) = str2double(parts{j});
        end
        
        % 提取类别标签（最后一列）
        classes{i} = parts{end};
    end
    
    % 创建类别映射
    class_mapping = containers.Map(...
        {'SEKER', 'BARBUNYA', 'BOMBAY', 'CALI', 'HOROZ', 'SIRA', 'DERMASON'}, ...
        1:7);
    
    % 转换类别标签为数值编码
    labels = zeros(line_count, 1);
    for i = 1:line_count
        labels(i) = class_mapping(classes{i});
    end
    
    % 获取数据集信息
    num_samples = line_count;
    
    % 显示数据集统计信息
    fprintf('成功读取Dry Bean数据集: %s\n', file_arff);
    fprintf('样本数量: %d\n', num_samples);
    fprintf('特征数量: %d\n', num_features);
    
    % 显示类别分布
    fprintf('\n类别分布:\n');
    class_names = keys(class_mapping);
    for i = 1:length(class_names)
        class_name = class_names{i};
        count = sum(strcmp(classes, class_name));
        percent = (count / num_samples) * 100;
        fprintf('  %-10s: %d (%.1f%%)\n', class_name, count, percent);
    end
    
    % 显示特征摘要统计
    fprintf('\n特征摘要统计:\n');
    feature_names = {
        'Area', 'Perimeter', 'MajorAxisLength', 'MinorAxisLength', ...
        'AspectRation', 'Eccentricity', 'ConvexArea', 'EquivDiameter', ...
        'Extent', 'Solidity', 'roundness', 'Compactness', ...
        'ShapeFactor1', 'ShapeFactor2', 'ShapeFactor3', 'ShapeFactor4'
    };
    
    fprintf('%-20s %10s %10s %10s %10s\n', 'Feature', 'Min', 'Max', 'Mean', 'Std');
    for i = 1:num_features
        col = num_data(:, i);
        fprintf('%-20s %10.2f %10.2f %10.2f %10.2f\n', ...
                feature_names{i}, min(col), max(col), mean(col), std(col));
    end
    
    % 合并标签和特征
    data_combined = [labels, num_data];
    
    % 随机打乱数据
    random_indices = randperm(size(data_combined, 1));
    data_random = data_combined(random_indices, :);
    
    % 显示打乱后的前几个样本的类别
    fprintf('\n数据已随机打乱，前5个样本的类别:\n');
    disp(data_random(1:5, 1)');
end